<?php

//teste
class Money {

    protected $amount;
    protected $currency;

    public function __construct($amount, $currency) {
        $this->amount = $amount;
        $this->currency = $currency;
    }

    public function equals($money) {
        return $this->amount == $money->amount && $this->currency() == $money->currency();
    }

    public function times($multiplier) {
        return new Money($this->amount * $multiplier, $this->currency);
    }

    public function plus($money) {
        return new Money($this->amount + $money->amount, $this->currency);
    }

    public function currency() {
        return $this->currency;
    }

    static public function Dollar($amount) {
        return new Money($amount, 'USD');
    }

    static public function Franc($amount) {
        return new Money($amount, 'CHF');
    }

}

?>
